import scrapy


class DlSpider(scrapy.Spider):
    name = "dl"
    allowed_domains = ["17k.com"]
    start_urls = ["https://user.17k.com/ck/user/98714981/get/new/msg?appKey=2406394919"]


    # # 重写最开始的请求方法
    # def start_requests(self):
    #     str = 'ASP.NET_SessionId=bmpsb34hmntrvljhpxpewqwv; xiaohua_web_userid=120326; xiaohua_web_userkey=r2sYazfFMt/rxUn8LJDmUYetwR2qsFCHIaNt7+Zpsscpp1p6zicW4w=='
    #     dict_cookie = {}
    #     for cookie in (str.split(';')):
    #         cookie_list = cookie.split('=', maxsplit=1)
    #         dict_cookie[cookie_list[0].replace(' ', '')] = cookie_list[1].replace(' ', '')
    #     # 发起请求  携带cookie
    #     yield scrapy.Request(self.start_urls[0], cookies=dict_cookie)

    def parse(self, response):
        # with open('dl.html', 'w', encoding='UTF-8') as f:
        #     f.write(response.text)
        print(response.text)
